package com.fumasoft.dynamic.config;

import com.fumasoft.dynamic.filter.TokenFilter;
import javax.servlet.Filter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * FilterConfig配置.
 *
 * @Author: jingchen
 * @Date: 2025/5/29
 * @Description:
 */
@Configuration
public class FilterConfig {

    /**
     * 注册TokenFilter.
     *
     * @return FilterRegistrationBean
     */
    @Bean
    public FilterRegistrationBean registrationTokenFilter() {
        FilterRegistrationBean<Filter> registrationBean = new FilterRegistrationBean<>();
        registrationBean.setFilter(new TokenFilter());
        registrationBean.addUrlPatterns();
        return registrationBean;
    }
}
